import Vue from 'vue'
import tpl from './tpl.html'
import './style.scss'
import Loading from '../../../../../grsc-base/component/Loading.vue';
import NoData from '../../../../../grsc-base/component/NoData.vue';
import service from './service';
import filter from "../../../../../grsc-base/util/filter";
import Pager from '../../../../../grsc-base/component/Pager.vue';
export default Vue.extend({
  name: "myReward",
  template: tpl,
  components: {
    Loading,
    NoData,
    Pager
  },
  data() {
    return {
      isLoading: true,
      isLoadings: true,
      list: [],
      rewardList: [],
      rewardList1: [],
      rewardList2: [],
      types: '自身解锁',
      pageNum: 0,
      num1:0,
      num2:0,
      nodata: false,
      InvitationList: [],
      countryList: ['自身解锁','奖励解锁'],
      filter,
      lotteryData: [],
      
      param: {
        pageNo: 1,
        pageSize: 20,
      }
    }
  },
  watch: {
    // types(val) {
    //   if (val == '邀请奖励') {
    //     this.param.rewardType = 'INVITE';
    //     this.getUserIepRewardList();
    //     return false
    //   }
    // }
  },
  created() {
    this.getUserIepRewardList();
  },
  methods: {
    reData(val) {
      let arr = [];
      if (this.types == '邀请奖励') {
        val[i].amount = val[i].prizeNumber;
        val[i].updateTime = val[i].dailyTime;
      } else if (this.types == '手续费奖励') {
        val[i].amount = val[i].refereePower
      }
      if (!arr[0]) {
        this.nodata = true;
      } else {
        this.nodata = false;
      }
      return arr
    },
    // 查询奖励
    getUserIepRewardList() {
      service.getUserIepRewardList(this.param).done(data => {
        this.isLoading = false;
        if (data.code == window.CODE.SUCCESS) {
          this.pageNum = data.data.pageNum;
          this.rewardList = data.data.list;
          this.isLoadings = false;
        } else {
          window.error(data.msg)
        }
      })
    },
    //翻页
    changePage(val) {
      this.param.pageNo = val;
      this.getUserIepRewardList();
    },
  }
})